#include "C3DObject.h"

using namespace std;

C3DObject::C3DObject(void)
{
	m_name = "";
}

C3DObject::~C3DObject(void)
{
	FreeObjects();
}

void C3DObject::FreeObjects()
{
	for(list<C3DObject*>::iterator it=m_objects.begin();it!=m_objects.end();++it)
	{
		delete *it;
	}
	m_objects.clear();
}

void C3DObject::AddObject( C3DObject* ptr )
{
	if(ptr!=NULL)
		m_objects.push_back(ptr);
}

void C3DObject::Draw()
{
	for(list<C3DObject*>::iterator it=m_objects.begin();it!=m_objects.end();++it)
	{
		(*it)->Draw();
	}
}

void C3DObject::SetPosition( GLfloat x, GLfloat y, GLfloat z )
{
	m_position.SetPoint(x,y,z);
}
